import java.util.ArrayList;

public class phones61 {
    public static void main(String[] args) {
        ArrayList<phones> list = new ArrayList<>();
        phones ph1 = new phones("小米",2999);
        phones ph2 = new phones("苹果",7999);
        phones ph3 = new phones("锤子",2999);
        list.add(ph1);
        list.add(ph2);
        list.add(ph3);
        ArrayList<phones> list2 = getPhone(list);
        for(int i = 0; i<list2.size(); i++){
            phones p =list2.get(i);
            System.out.println(p.getPrice()+ "," + p.getBrand());
        }
    }
      public static ArrayList<phones> getPhone(ArrayList<phones> list){
        ArrayList<phones> phones = new ArrayList<>();
        for(int i = 0; i<list.size();i++){
            phones ph = list.get(i);
            int p =ph.getPrice();
            if(p<3000){
                phones.add(ph);
            }
        }
        return phones;
      }
}
